
LIBS = `MCubes-config --ldflags`
CFLAGS  = `MCubes-config --cflags`
SRC = $(wildcard *.cpp)
HEADER = $(wildcard *.h)

INC = -fopenmp $(CFLAGS)
OPT = -Wall -Wextra -pedantic -Wdeprecated
#-std=gnu++11

ifeq ($(MYLOCAL),)
	MYLOCAL = $(HOME)/local
endif

triangulate = triangulate.cpp
ARCH = $(shell uname -m)

BINARY = triangulate.$(ARCH)

triangulate: $(triangulate) $(HEADER)
	g++ $(triangulate) -o $(BINARY) $(OPT) $(INC) $(LIBS)
	cd $(MYLOCAL)/bin && ln -sf  $(PWD)/$(BINARY) $(BINARY)
	mkdir -p  ~/.bash_completion.d
	$(BINARY) --bash_completion && cp $(BINARY).bash_completion ~/.bash_completion.d/


doc: $(SRC)
	doxygen
	firefox doc/index.htm&

# nohup ./triangulate.$(ARCH) ../01_segmentation/segmentation_1201.gipl test/slice -B -r 0.3 -t 600,800 &
run: triangulate
	triangulate.x86_64 ../01_segmentation/segmentation_1201.gipl test/slice -r 2000 -t 600,800 -x 1000. --rescale 1000. -e 40. -s 0 -CITBM -2 -v

clean:
	rm -rf triangulate *.o *~

.Phony:
	mylib
